# from flask_script import Manager
from controller import create_app
from flask import Flask, render_template, redirect, request, url_for , send_file
from flask import Flask,jsonify,request

# 创建APP对象
app = create_app('dev')
# # 创建脚本管理
# mgr = Manager(app)

@app.route('/register')
def register():
    return render_template('register.html')

@app.route("/getData",methods=["GET", "POST"])
def getData():
    data =  {"code":0,"msg":"","count":1000,
             "data":[{"num":1,"username":"j2ee","number":"8209190166","location":"湖南省长沙市铁道学院铁二舍",
                      "time":"2021-5-10 19:10:10","experience":255},
                     {"num": 2, "username": "j2ee1", "number": "8209190165", "location": "湖南省长沙市铁道学院铁二舍",
                      "time": "2021-5-10 19:10:12", "experience": 255},
                     ]}
    return jsonify(data)

@app.route('/photo')
def checkPhoto():
    return render_template('camera/photo.html')

@app.route('/sleep')
def checkSleep():
    return render_template('camera/checkSleep.html')

if __name__ == '__main__':
    # mgr.run()
    app.run(threaded=True, host="127.0.0.1")

